package paskal.ui.components;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
import javax.swing.plaf.basic.BasicViewportUI;

import paskal.ui.Style;

public class ScrollPane extends JScrollPane implements Component {
	private static final long serialVersionUID = -245278489455135903L;

	public ScrollPane(java.awt.Component view, int vsbPolicy, int hsbPolicy) {
		super(view, vsbPolicy, hsbPolicy);
		setOpaque(false);
		setBackground(new Color(0, 0, 0, 0));

		final JViewport v = getViewport();
		v.setOpaque(false);
		v.setUI(new BasicViewportUI() {
			@Override
			public void paint(Graphics g, JComponent c) {
				g.setColor(getBackground());
				g.fillRect(0, 0, getWidth(), getHeight());
				super.paint(g, c);
			}
		});
		paskal.ui.components.ScrollBar scrollBar = new paskal.ui.components.ScrollBar();
		scrollBar.stylize("scrollBar");
		setVerticalScrollBar(scrollBar);
	}

	@Override
	protected void paintBorder(Graphics g) {
	}

	@Override
	public void stylize(String selector) {
		Style.getInstance().styleThisShit(selector, this);
	}

	@Override
	public void setProperty(String key, Object value) {

	}
}
